<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('考勤信息变动历史查看')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="user-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                姓名：<input type="text" name="name"/>
                            </li>
                            <li>
                                工号：<input type="text" name="badge"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">

            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>

<script th:inline="javascript">
    var prefix = ctx + "attendEmpManage/AttendChange";
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 800) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 350});
        queryData();
    });

    function queryData() {
        var columns = [];
        var term = {field: 'term', title: '登记日期'};
        var badge = {field: 'badge', title: '工号'};
        var name = {field: 'name', title: '姓名'};
        var compName = {field: 'compName', title: '公司名称'};
        var depName = {field: 'depName', title: '部门名称'};
        var jobName = {field: 'jobName', title: '工作岗位'};
        var atEmpType = {field: 'atEmpType', title: '考勤员工类型'};
        var atEmpTypeNew = {field: 'atEmpTypeNew', title: '新考勤员工类型'};
        var remark = {field: 'remark', title: '备注'};
        var initialized = {
            field: 'initialized',
            title: '是否确认',
            formatter: function (value, row, index) {
                return showCheckInitialized(row);
            }
        };
        var initializedName = {field: 'initializedName', title: '确认人'};
        var initializedTime = {field: 'initializedTime', title: '确认时间'};
        var closed = {
            field: 'closed',
            title: '是否封存',
            formatter: function (value, row, index) {
                return showCheckInitialized(row);
            }
        };
        var closedName = {field: 'closedName', title: '封存人'};
        var closedTime = {field: 'closedTime', title: '封存时间'};
        columns.push(term, badge, name, compName, depName, jobName, atEmpType, atEmpTypeNew,
            remark, initialized, initializedName, initializedTime, closed, closedName, closedTime);

        var options = {
            code: "id",
            uniqueId: "id",
            url: prefix + "/history",
            height: $(window).height() - 120,
            sortOrder: "desc",
            modalName: "考勤信息变动历史查看",
            columns: columns
        };
        $.table.init(options);
    }

    function showCheck(row) {
        if (row.isdxsj) {
            return '<i class="fa fa-toggle-on text-info fa-2x"></i> ';
        } else {
            return '<i class="fa fa-toggle-off text-info fa-2x"></i> ';
        }
    }

    function showCheckInitialized(row) {
        if (row.closed) {
            return '<i class="fa fa-toggle-on text-info fa-2x"></i> ';
        } else {
            return '<i class="fa fa-toggle-off text-info fa-2x"></i> ';
        }
    }

    function showCheckClosed(row) {
        if (row.isdxsj) {
            return '<i class="fa fa-toggle-on text-info fa-2x"></i> ';
        } else {
            return '<i class="fa fa-toggle-off text-info fa-2x"></i> ';
        }
    }

</script>
</body>
</html>